/*
 *
 *  ------------------------------------------------------------------
 *  Copyright © 2017 Hangzhou DtDream Technology Co.,Lt d. All rights reserved.
 *  ------------------------------------------------------------------
 *        Product:  EMR
 *    Module Name: NEZHA
 *   Date Created: 17-10-23 下午4:22
 *    Description:
 *  ------------------------------------------------------------------
 *  Modification History
 *  DATE            Name           Description
 *  ------------------------------------------------------------------
 *  2017-10-23      NEZHA EMR
 *  ------------------------------------------------------------------
 * /
 */

package org.xukai.remoting.sdk.web.api.serde;

import com.dtdream.emr.common.codec.JacksonCodec;
import okhttp3.MediaType;
import okhttp3.RequestBody;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by moriarty on 17-2-23.
 */
public class SubmitJobSerDe extends HttpSerDe<String> {

    private Iterable<String> sqls;

    public SubmitJobSerDe(List<String> sqls) {
        super(String.class);
        this.sqls = sqls;
    }

    @Override
    public RequestBody serialize() throws IOException {
        Map<String, Object> jsonObj = new HashMap<>(1);
        jsonObj.put("sqls", sqls);
        return RequestBody.create(MediaType.parse("application/json"), JacksonCodec.serialize(jsonObj));
    }
}
